home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscTableScroll / MiscTableScrollInspector.M < prev    next >
Encoding:
Text File  |  1996-02-11  |  21.6 KB  |  766 lines

  1. //=============================================================================
  2. //
  3. //        Copyright (C) 1995 by Paul S. McCarthy and Eric Sunshine.
  4. //                Written by Paul S. McCarthy and Eric Sunshine.
  5. //                            All Rights Reserved.
  6. //
  7. //        This notice may not be removed from this source code.
  8. //
  9. //        This object is included in the MiscKit by permission from the authors
  10. //        and its use is governed by the MiscKit license, found in the file
  11. //        "License.rtf" in the MiscKit distribution.    Please refer to that file
  12. //        for a list of all applicable permissions and restrictions.
  13. //        
  14. //=============================================================================
  15. //-----------------------------------------------------------------------------
  16. // MiscTableScrollInspector.M
  17. //
  18. //        Interface Builder inspector for MiscTableScroll.
  19. //
  20. //-----------------------------------------------------------------------------
  21. //-----------------------------------------------------------------------------
  22. // $Id: MiscTableScrollInspector.M,v 1.6 95/10/20 00:13:20 sunshine Exp $
  23. // $Log:        MiscTableScrollInspector.M,v $
  24. //    Revision 1.6  95/10/20    00:13:20  sunshine
  25. //    Was including MiscTableScroll.h with "" instead of <>.
  26. //    
  27. //    Revision 1.5  95/10/19    05:40:38  sunshine
  28. //    Fixed bugs and inter-locks.     Now does more sensible enabling of controls.
  29. //    For instance "sizable" is enabled even when there is a uniform size.  Now
  30. //    if the user turns on "sizable" it sets uniform size to 0 and disables the
  31. //    field (this is more convenient since in the past the user had to manually
  32. //    set it to 0 before being able to turn on the switch).
  33. //    
  34. //    Revision 1.4  95/10/03    23:20:46  zarnuk
  35. //    comments.
  36. //-----------------------------------------------------------------------------
  37. #import "MiscTableScrollInspector.h"
  38. #import "MiscTableBorder.h"
  39. #import <misckit/MiscTableScroll.h>
  40.  
  41. extern "Objective-C" {
  42. #import <appkit/Application.h>
  43. #import <appkit/Button.h>
  44. #import <appkit/ButtonCell.h>
  45. #import <appkit/Matrix.h>
  46. #import <appkit/NXColorWell.h>
  47. #import <appkit/PopUpList.h>
  48. #import <appkit/ScrollView.h>
  49. #import <appkit/TextField.h>
  50. }
  51.  
  52. //=============================================================================
  53. // IB-ONLY METHODS FOR MiscTableScroll
  54. //=============================================================================
  55. @interface MiscTableScroll(IB)
  56. - (char const*)getInspectorClassName;
  57. - editSelf: sender in: owner;
  58. - (BOOL) isInIB;
  59. - (void) initIB;
  60. @end
  61. @implementation MiscTableScroll(IB)
  62. - (char const*)getInspectorClassName
  63.     {
  64.     return "MiscTableScrollInspector";
  65.     }
  66.  
  67. - editSelf: sender in: owner // keep IB from allowing double-click to edit SV
  68.     {
  69.     return nil;
  70.     }
  71.  
  72. - (BOOL) isInIB { return YES; }
  73.  
  74. - (void) initIB
  75.     {
  76.     [self addCol];
  77.     [self addCol];
  78.     [self setCol: 1 autosize: YES];
  79.     [self tile];
  80.     }
  81. @end
  82.  
  83. //=============================================================================
  84. // CONVENIENCE CATAGORIES
  85. //=============================================================================
  86. @interface Button(MiscPopUpList)
  87. - (int) popUpTag;
  88. - (void) setPopUpTag: (int) new_tag;
  89. @end
  90.  
  91. @interface Matrix(MiscPopUpList)
  92. - (int) popUpTag;
  93. @end
  94.  
  95. @implementation Button(MiscPopUpList)
  96.  
  97. - (int) popUpTag
  98.     {
  99.     id popUp = [self target];
  100.     return [[[popUp itemList] selectedCell] tag];
  101.     }
  102.  
  103. - (void) setPopUpTag: (int) new_tag
  104.     {
  105.     id popUp = [self target];
  106.     Matrix* matrix = [popUp itemList];
  107.     MenuCell* m_cell = [matrix findCellWithTag: new_tag];
  108.     [matrix selectCell: m_cell];
  109.     [self setTitle: [m_cell title]];
  110.     }
  111.  
  112. @end
  113.  
  114. @implementation Matrix(MiscPopUpList)
  115.  
  116. - (int) popUpTag
  117.     {
  118.     return [[self selectedCell] tag];
  119.     }
  120.  
  121. @end
  122.  
  123.  
  124. //=============================================================================
  125. // IMPLEMENTATION
  126. //=============================================================================
  127. @interface MiscTableScrollInspector(Forward)
  128. - doSlot:sender;
  129. - doTitleMode:sender;
  130. @end
  131.  
  132. @implementation MiscTableScrollInspector
  133.  
  134. //-----------------------------------------------------------------------------
  135. // init
  136. //-----------------------------------------------------------------------------
  137. - init
  138.     {
  139.     [super init];
  140.     char buf[ MAXPATHLEN + 1 ];
  141.     id bundle = [NXBundle bundleForClass: [MiscTableScrollInspector class]];
  142.     [bundle getPath: buf forResource: [[self class] name] ofType: "nib"];
  143.     [NXApp loadNibFile: buf owner: self withNames: NO fromZone: [self zone]];
  144.     border_type = MISC_COL_BORDER;
  145.     dirty = NO;
  146.     return self;
  147.     }
  148.  
  149.  
  150. //-----------------------------------------------------------------------------
  151. // wantsButtons
  152. //-----------------------------------------------------------------------------
  153. - (BOOL) wantsButtons
  154.     {
  155.     return NO;
  156.     }
  157.  
  158.  
  159. //-----------------------------------------------------------------------------
  160. // setTitleControls
  161. //-----------------------------------------------------------------------------
  162. - (void) setTitleControls
  163.     {
  164.     if ([object borderTitlesOn:border_type])
  165.         {
  166.         BOOL sizable = border->isSizeable();
  167.         [titlesSwitch setState:1];
  168.         [[sizableSwitch setEnabled: YES] setState:sizable];
  169.         [[draggableSwitch setEnabled:YES] setState:border->isDraggable()];
  170.         [[titleModePopUp setEnabled:YES]
  171.                 setPopUpTag:(int)[object borderTitleMode:border_type]];
  172.         [uniformSizeField setEnabled:!sizable];
  173.         if (sizable)
  174.             [uniformSizeField setStringValueNoCopy:""];
  175.         else
  176.             [uniformSizeField setIntValue:
  177.                                 int([object uniformSizeSlots:border_type])];
  178.         }
  179.     else
  180.         {
  181.         [titlesSwitch setState:0];
  182.         [[sizableSwitch setEnabled:NO] setState:0];
  183.         [[draggableSwitch setEnabled:NO] setState:0];
  184.         [[titleModePopUp setEnabled:NO]
  185.                 setPopUpTag:(int)[object borderTitleMode:border_type]];
  186.         [[uniformSizeField setEnabled: YES]
  187.                 setIntValue: int([object uniformSizeSlots:border_type])];
  188.         }
  189.     }
  190.  
  191.  
  192. //-----------------------------------------------------------------------------
  193. // fillScroll
  194. //-----------------------------------------------------------------------------
  195. - (void) fillScroll
  196.     {
  197.     [window disableFlushWindow];
  198.     num_slots = [object numSlots:border_type];
  199.     if (num_slots == 0)
  200.         {
  201.         [slotScroll clearSelectedCell];
  202.         [slotScroll renewRows:0 cols:0]; // Gets rid of horiz scroller knob
  203.         }
  204.     else
  205.         {
  206.         [slotScroll renewRows:num_slots cols:1];
  207.         for (int i = 0;     i < num_slots;     i++)
  208.             {
  209.             int const pslot = [object border:border_type slotAtPosition:i];
  210.             [[slotScroll cellAt:i:0] setTitle: [object border:border_type
  211.                         slotTitle:pslot]];
  212.             }
  213.         }
  214.     [slotScroll sizeToCells];
  215.     [slotScroll display];
  216.  
  217.     if (num_slots > 0)
  218.         {
  219.         if (slot < 0) slot = 0;
  220.         [slotScroll selectCellAt:slot:0];
  221.         [slotScroll scrollCellToVisible:slot:0];
  222.         }
  223.     else
  224.         {
  225.         slot = -1;
  226.         }
  227.     [self doSlot:self];
  228.     [[window reenableFlushWindow] flushWindow];
  229.     }
  230.  
  231.  
  232. //-----------------------------------------------------------------------------
  233. // setConstrainSwitches
  234. //-----------------------------------------------------------------------------
  235. - (void) setConstrainSwitches
  236.     {
  237.     [constrainMaxSwitch setState:
  238.                 [object maxTotalSizeIsConstrained:border_type]];
  239.     [constrainMinSwitch setState:
  240.                 [object minTotalSizeIsConstrained:border_type]];
  241.     }
  242.  
  243.  
  244.  
  245. //-----------------------------------------------------------------------------
  246. // doConstrainMax:
  247. //-----------------------------------------------------------------------------
  248. - doConstrainMax:sender
  249.     {
  250.     [object border:border_type
  251.                 constrainMaxTotalSize:[constrainMaxSwitch state]];
  252.     return [self ok:sender];
  253.     }
  254.  
  255.  
  256.  
  257. //-----------------------------------------------------------------------------
  258. // doConstrainMin:
  259. //-----------------------------------------------------------------------------
  260. - doConstrainMin:sender
  261.     {
  262.     [object border:border_type
  263.                 constrainMinTotalSize:[constrainMinSwitch state]];
  264.     return [self ok:sender];
  265.     }
  266.  
  267.  
  268.  
  269. //-----------------------------------------------------------------------------
  270. // doEnabled:
  271. //-----------------------------------------------------------------------------
  272. - doEnabled: sender
  273.     {
  274.     [object setEnabled: [enabledSwitch state]];
  275.     return [self ok:sender];
  276.     }
  277.  
  278.  
  279. //-----------------------------------------------------------------------------
  280. // doLazy:
  281. //-----------------------------------------------------------------------------
  282. - doLazy: sender
  283.     {
  284.     [object setLazy: [lazySwitch state]];
  285.     return [self ok:sender];
  286.     }
  287.  
  288.  
  289. //-----------------------------------------------------------------------------
  290. // doMode:
  291. //-----------------------------------------------------------------------------
  292. - doMode: sender
  293.     {
  294.     [object setSelectionMode: MiscSelectionMode([modePopUp popUpTag])];
  295.     return [self ok:sender];
  296.     }
  297.  
  298.  
  299. //-----------------------------------------------------------------------------
  300. // doBorder:
  301. //-----------------------------------------------------------------------------
  302. - doBorder:sender
  303.     {
  304.     MiscBorderType bt = MiscBorderType([borderPopUp popUpTag]);
  305.     if (bt != border_type)
  306.         {
  307.         border_type = bt;
  308.         [self revert:sender];
  309.         }
  310.     return self;
  311.     }
  312.  
  313.  
  314. //-----------------------------------------------------------------------------
  315. // doTitles:
  316. //-----------------------------------------------------------------------------
  317. - doTitles: sender
  318.     {
  319.     BOOL const isOn = [titlesSwitch state];
  320.     [object border:border_type setTitlesOn: isOn];
  321.     [self setTitleControls];
  322.     return [self ok:sender];
  323.     }
  324.  
  325.  
  326. //-----------------------------------------------------------------------------
  327. // doSizable:
  328. //-----------------------------------------------------------------------------
  329. - doSizable: sender
  330.     {
  331.     BOOL const val = [sizableSwitch state];
  332.     [object border:border_type setSizeableSlots:val];
  333.     if (val)
  334.         {
  335.         [[uniformSizeField setStringValue:""] setEnabled:NO];
  336.         [object border:border_type setUniformSizeSlots:0];
  337.         }
  338.     else
  339.         {
  340.         [[uniformSizeField setEnabled: YES]
  341.                 setIntValue: int([object uniformSizeSlots:border_type])];
  342.         }
  343.     [self doSlot:0];
  344.     return [self ok:sender];
  345.     }
  346.  
  347.  
  348. //-----------------------------------------------------------------------------
  349. // doDraggable:
  350. //-----------------------------------------------------------------------------
  351. - doDraggable: sender
  352.     {
  353.     [object border:border_type setDraggableSlots:[draggableSwitch state]];
  354.     return [self ok:sender];
  355.     }
  356.  
  357.  
  358. //-----------------------------------------------------------------------------
  359. // doAutoSort:
  360. //-----------------------------------------------------------------------------
  361. - doAutoSort: sender
  362.     {
  363.     [object border:border_type setAutoSortSlots:[autoSortSwitch state]];
  364.     return [self ok:sender];
  365.     }
  366.  
  367.  
  368. //-----------------------------------------------------------------------------
  369. // doTitleMode:
  370. //-----------------------------------------------------------------------------
  371. - doTitleMode:sender
  372.     {
  373.     [object border:border_type
  374.         setTitleMode: (MiscTableTitleMode) [titleModePopUp popUpTag]];
  375.     [self fillScroll];
  376.     return [self ok:sender];
  377.     }
  378.  
  379.  
  380. //-----------------------------------------------------------------------------
  381. // doDelete:
  382. //-----------------------------------------------------------------------------
  383. - doDelete: sender
  384.     {
  385.     [object border:border_type
  386.                 deleteSlotAt:[object border:border_type slotAtPosition:slot]];
  387.     [object tile];
  388.     [object display];
  389.     slot--;
  390.     num_slots--;
  391.     if (slot < 0 && num_slots > 0)
  392.         slot = 0;
  393.     [self fillScroll];
  394.     [self ok:sender];
  395.     return self;
  396.     }
  397.  
  398.  
  399. //-----------------------------------------------------------------------------
  400. // doNew:
  401. //-----------------------------------------------------------------------------
  402. - doNew: sender
  403.     {
  404.     [object addSlot:border_type];
  405.     [object tile];
  406.     [object display];
  407.     slot = num_slots;
  408.     [self fillScroll];
  409.     [self ok:sender];
  410.     return self;
  411.     }
  412.  
  413.  
  414. //-----------------------------------------------------------------------------
  415. // doUserSizeable:
  416. //-----------------------------------------------------------------------------
  417. - doUserSizeable: sender
  418.     {
  419.     [object border:border_type
  420.                 setSlot:[object border:border_type slotAtPosition:slot]
  421.                 sizeable:[userSizeableSwitch state]];
  422.     return [self ok:sender];
  423.     }
  424.  
  425.  
  426. //-----------------------------------------------------------------------------
  427. // doExpandToData:
  428. //-----------------------------------------------------------------------------
  429. - doExpandToData: sender
  430.     {
  431.     [object border:border_type
  432.                 setSlot:[object border:border_type slotAtPosition:slot]
  433.                 expandsToData:[expandToDataSwitch state]];
  434.     return [self ok:sender];
  435.     }
  436.  
  437.  
  438. //-----------------------------------------------------------------------------
  439. // doAutosize:
  440. //-----------------------------------------------------------------------------
  441. - doAutosize: sender
  442.     {
  443.     [object border:border_type
  444.                 setSlot:[object border:border_type slotAtPosition:slot]
  445.                 autosize:[autosizeSwitch state]];
  446.     return [self ok:sender];
  447.     }
  448.  
  449.  
  450. //-----------------------------------------------------------------------------
  451. // doCellClass:
  452. //-----------------------------------------------------------------------------
  453. - doCellClass: sender
  454.     {
  455.     [object border:border_type
  456.         setSlot:[object border:border_type slotAtPosition:slot]
  457.         cellType: (MiscTableCellStyle) [cellClassPopUp popUpTag]];
  458.     return [self ok:sender];
  459.     }
  460.  
  461.  
  462. //-----------------------------------------------------------------------------
  463. // doSortType:
  464. //-----------------------------------------------------------------------------
  465. - doSortType: sender
  466.     {
  467.     [object border:border_type
  468.         setSlot:[object border:border_type slotAtPosition:slot]
  469.         sortType: (MiscSortType) [sortTypePopUp popUpTag]];
  470.     return [self ok:sender];
  471.     }
  472.  
  473.  
  474. //-----------------------------------------------------------------------------
  475. // doSortDirection:
  476. //-----------------------------------------------------------------------------
  477. - doSortDirection: sender
  478.     {
  479.     [object border:border_type
  480.         setSlot:[object border:border_type slotAtPosition:slot]
  481.         sortDirection: (MiscSortDirection) [sortDirectionPopUp popUpTag]];
  482.     return [self ok:sender];
  483.     }
  484.  
  485.  
  486. //-----------------------------------------------------------------------------
  487. // doSlot:
  488. //-----------------------------------------------------------------------------
  489. - doSlot: sender
  490.     {
  491.     slot = [slotScroll selectedRow];
  492.     if (slot >= 0)
  493.         {
  494.         BOOL const titlesOn = [object borderTitlesOn:border_type];
  495.         BOOL const notUniform = ([object uniformSizeSlots:border_type] == 0);
  496.         int pslot = [object border:border_type slotAtPosition:slot];
  497.         [deleteButton setEnabled:YES];
  498.         [upButton setEnabled:(slot > 0)];
  499.         [downButton setEnabled:(slot < num_slots - 1)];
  500.         [[cellClassPopUp setEnabled:YES]
  501.                 setPopUpTag:(int)
  502.                         [object border:border_type slotCellType:pslot]];
  503.         [[sortTypePopUp setEnabled:YES]
  504.                 setPopUpTag:(int)
  505.                         [object border:border_type slotSortType:pslot]];
  506.         [[sortDirectionPopUp setEnabled:YES]
  507.                 setPopUpTag:(int)
  508.                         [object border:border_type slotSortDirection:pslot]];
  509.         [[autosizeSwitch setEnabled:notUniform]
  510.                 setState:[object border:border_type slotIsAutosize:pslot]];
  511.         [[expandToDataSwitch setEnabled:notUniform]
  512.                 setState:[object border:border_type slotExpandsToData:pslot]];
  513.         [[userSizeableSwitch setEnabled:
  514.                 titlesOn && notUniform && [object sizeableSlots:border_type]]
  515.                 setState:[object border:border_type slotIsSizeable:pslot]];
  516.         [[sizeField setEnabled:notUniform]
  517.                 setIntValue: (int)
  518.                         [object border:border_type slotSize:pslot]];
  519.         [[sizeMinField setEnabled:notUniform]
  520.                 setIntValue: (int)
  521.                         [object border:border_type slotMinSize:pslot]];
  522.         [[sizeMaxField setEnabled:notUniform]
  523.                 setIntValue: (int)
  524.                         [object border:border_type slotMaxSize:pslot]];
  525.         [[titleField setEnabled:
  526.                 [object borderTitlesOn:border_type] &&
  527.                 ([object borderTitleMode:border_type] == MISC_CUSTOM_TITLE)]
  528.                 setStringValue: [object border:border_type slotTitle:pslot]];
  529.         [titleField selectText: self];
  530.         }
  531.     else
  532.         {
  533.         [deleteButton setEnabled:NO];
  534.         [upButton setEnabled:NO];
  535.         [downButton setEnabled:NO];
  536.         [[cellClassPopUp setEnabled:YES] setPopUpTag:0];
  537.         [[sortTypePopUp setEnabled:YES] setPopUpTag:0];
  538.         [[sortDirectionPopUp setEnabled:YES] setPopUpTag:0];
  539.         [[autosizeSwitch setEnabled:NO] setState:0];
  540.         [[expandToDataSwitch setEnabled:NO] setState:0];
  541.         [[userSizeableSwitch setEnabled:NO] setState:0];
  542.         [[sizeField setEnabled:NO] setStringValue:""];
  543.         [[sizeMinField setEnabled:NO] setStringValue:""];
  544.         [[sizeMaxField setEnabled:NO] setStringValue:""];
  545.         [[titleField setEnabled:NO] setStringValue:""];
  546.         }
  547.     return self;
  548.     }
  549.  
  550.  
  551. //-----------------------------------------------------------------------------
  552. // doUp:
  553. //-----------------------------------------------------------------------------
  554. - doUp: sender
  555.     {
  556.     if (slot > 0)
  557.         {
  558.         [object border:border_type moveSlotFrom:slot to:slot-1];
  559.         border->clearVMap();
  560.         slot--;
  561.         [self fillScroll];
  562.         [self ok:sender];
  563.         }
  564.     return self;
  565.     }
  566.  
  567.  
  568. //-----------------------------------------------------------------------------
  569. // doDown:
  570. //-----------------------------------------------------------------------------
  571. - doDown: sender
  572.     {
  573.     if (slot < num_slots - 1)
  574.         {
  575.         [object border:border_type moveSlotFrom:slot to:slot+1];
  576.         border->clearVMap();
  577.         slot++;
  578.         [self fillScroll];
  579.         [self ok:sender];
  580.         }
  581.     return self;
  582.     }
  583.  
  584.  
  585. //-----------------------------------------------------------------------------
  586. // get_pslot
  587. //        Get the physical slot-id of the current slot.
  588. //-----------------------------------------------------------------------------
  589. - (int) get_pslot
  590.     {
  591.     return [object border:border_type slotAtPosition:slot];
  592.     }
  593.  
  594.  
  595. //-----------------------------------------------------------------------------
  596. // textDidChange:
  597. //-----------------------------------------------------------------------------
  598. - textDidChange:sender
  599.     {
  600.     dirty = YES;
  601.     return [super textDidChange:sender];
  602.     }
  603.  
  604.  
  605. //-----------------------------------------------------------------------------
  606. // textDidEnd:endChar:
  607. //-----------------------------------------------------------------------------
  608. - textDidEnd: sender endChar: (unsigned short) whyEnd
  609.     {
  610.     if (dirty)
  611.         {
  612.         dirty = NO;
  613.         id field = 0;
  614.         if ([sender respondsTo:@selector(delegate)])
  615.             field = [sender delegate];
  616.         if (field == (id)titleField)
  617.             {
  618.             int const pslot = [self get_pslot];
  619.             [object border:border_type setSlot:pslot
  620.                                             title:[titleField stringValue]];
  621.             [[slotScroll cellAt:slot:0] setTitle:[titleField stringValue]];
  622.             [slotScroll drawCellAt:slot:0];
  623.             }
  624.         else if (field == (id)uniformSizeField)
  625.             {
  626.             int old_size = (int) [object uniformSizeSlots:border_type];
  627.             int new_size = [uniformSizeField intValue];
  628.             if (new_size != 0)
  629.                 {
  630.                 if (new_size < MISC_MIN_PIXELS_SIZE)
  631.                     new_size = MISC_MIN_PIXELS_SIZE;
  632.                 if (new_size > MISC_MAX_PIXELS_SIZE)
  633.                     new_size = MISC_MAX_PIXELS_SIZE;
  634.                 [uniformSizeField setIntValue:new_size];
  635.                 }
  636.             if (old_size != new_size)
  637.                 {
  638.                 [object border:border_type
  639.                         setUniformSizeSlots:(NXCoord)new_size];
  640.                 [self ok:sender];
  641.                 [self revert:0];
  642.                 }
  643.             }
  644.         else if (field == (id)sizeField || field == (id)sizeMinField ||
  645.                  field == (id)sizeMaxField)
  646.             {
  647.             int const pslot = [self get_pslot];
  648.             int i = [sizeField intValue];
  649.             int imax = [sizeMaxField intValue];
  650.             int imin = [sizeMinField intValue];
  651.             if (field == (id)sizeMaxField)
  652.                 {
  653.                 if (imax > MISC_MAX_PIXELS_SIZE) imax = MISC_MAX_PIXELS_SIZE;
  654.                 else if (imax < imin) imax = imin;
  655.                 [sizeMaxField setIntValue: imax];
  656.                 [object border:border_type
  657.                         setSlot:pslot maxSize:(NXCoord)imax];
  658.                 }
  659.             else if (field == (id)sizeMinField)
  660.                 {
  661.                 if (imin < MISC_MIN_PIXELS_SIZE) imin = MISC_MIN_PIXELS_SIZE;
  662.                 else if (imin > imax) imin = imax;
  663.                 [sizeMinField setIntValue: imin];
  664.                 [object border:border_type
  665.                         setSlot:pslot minSize:(NXCoord)imin];
  666.                 }
  667.     
  668.             if (i < imin || i > imax) // May need to do every time
  669.                 {
  670.                 if (i < imin) i = imin;
  671.                 if (i > imax) i = imax;
  672.                 [sizeField setIntValue: i];
  673.                 }
  674.             [object border:border_type setSlot:pslot size:(NXCoord)i];
  675.             }
  676.         [self ok: sender];
  677.         }
  678.     return self;
  679.     }
  680.  
  681.  
  682. //-----------------------------------------------------------------------------
  683. // doColorText
  684. //-----------------------------------------------------------------------------
  685. - doColorText: sender
  686.     {
  687.     [object setTextColor: [sender color]];
  688.     return [self ok:sender];
  689.     }
  690.  
  691.  
  692. //-----------------------------------------------------------------------------
  693. // doColorBack
  694. //-----------------------------------------------------------------------------
  695. - doColorBack: sender
  696.     {
  697.     [object setBackgroundColor: [sender color]];
  698.     return [self ok:sender];
  699.     }
  700.  
  701.  
  702. //-----------------------------------------------------------------------------
  703. // doColorTextH
  704. //-----------------------------------------------------------------------------
  705. - doColorTextH: sender
  706.     {
  707.     [object setHighlightTextColor: [sender color]];
  708.     return [self ok:sender];
  709.     }
  710.  
  711.  
  712. //-----------------------------------------------------------------------------
  713. // doColorBackH
  714. //-----------------------------------------------------------------------------
  715. - doColorBackH: sender
  716.     {
  717.     [object setHighlightBackgroundColor: [sender color]];
  718.     return [self ok:sender];
  719.     }
  720.  
  721.  
  722. //-----------------------------------------------------------------------------
  723. // ok:
  724. //-----------------------------------------------------------------------------
  725. - ok: sender
  726.     {
  727.     return [super ok: sender];
  728.     }
  729.  
  730.  
  731. //-----------------------------------------------------------------------------
  732. // revert:
  733. //-----------------------------------------------------------------------------
  734. - revert: sender
  735.     {
  736.     dirty = NO;
  737.     [super revert: sender];
  738.     [window disableFlushWindow];
  739.  
  740.     border = [object border:border_type];
  741.     [autoSortSwitch setState:[object autoSortSlots:border_type]];
  742.     [self setTitleControls];
  743.  
  744.     [self setConstrainSwitches];
  745.  
  746.     [enabledSwitch setState: [object isEnabled]];
  747.     [lazySwitch setState: [object isLazy]];
  748.     [modePopUp setPopUpTag:(int) [object selectionMode]];
  749.  
  750.     [colorText    setColor: [object textColor]];
  751.     [colorTextH setColor: [object highlightTextColor]];
  752.     [colorBack    setColor: [object backgroundColor]];
  753.     [colorBackH setColor: [object highlightBackgroundColor]];
  754.  
  755.     slot = -1;
  756.     [self fillScroll];
  757.  
  758.     id fr = [window firstResponder];
  759.     if (fr == 0 || fr == window)
  760.         [titleField selectText: self];
  761.     [[window reenableFlushWindow] flushWindow];
  762.     return self;
  763.     }
  764.  
  765. @end
  766.